package com.example.roadeyeserver.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.roadeyeserver.annotation.DS;
import com.example.roadeyeserver.entity.ZjcbAis;
import com.example.roadeyeserver.entity.vo.ZjcbAisVO;
import com.example.roadeyeserver.mapper.ZjcbAisMapper;
import com.example.roadeyeserver.result.Result;
import com.example.roadeyeserver.service.ZjcbAisService;
import com.example.roadeyeserver.util.ResultUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
@Slf4j
public class ZjcbAisServiceImpl extends ServiceImpl<ZjcbAisMapper, ZjcbAis> implements ZjcbAisService {

    @Resource
    private ZjcbAisMapper zjcbAisMapper;

    @Override
    @DS("db2")
    public Result<List<ZjcbAisVO>> getLatestRecords() {
        List<ZjcbAisVO> result = zjcbAisMapper.getLatestRecords();
        log.info("查询到:{}条结果", result.size());
        return ResultUtil.success(result);
    }
}
